<template>
    <div>
        <Form :model="formItem" inline>
            <FormItem>
                <Input v-model="formItem.company"  placeholder="单位"></Input>
            </FormItem>
            <FormItem>
                <Input v-model="formItem.end_time"  placeholder="休眠时长(天)"></Input>
            </FormItem>
            <FormItem>
                <Button type="success" @click="search">搜索</Button>
            </FormItem>
            <FormItem>
                <Button type="info" @click="see">查看</Button>
            </FormItem>
            <FormItem>
                <Button type="primary" @click="exportData">导出</Button>
            </FormItem>
        </Form>
        <Table border :columns="columns6" :data="data6" ref="table">
            <!--            <template slot-scope="{ row }" slot="action">-->
            <!--                <Button type="primary" size="small" style="margin-right: 5px" @click="show(row)">查看详情</Button>-->
            <!--            </template>-->
        </Table>
        <Row type="flex" justify="end" style="margin-top: 25px">
            <Page :total="total" show-total @on-change="pageAction" />
        </Row>
    </div>
</template>

<script>
import { getSpvOilcompaniesList } from '@/api/user'
export default {
  data () {
    return {
      total: 0,
      formItem: {
        company: '',
        end_time: '30'
      },
      columns6: [
        {
          title: '单位名称',
          key: 'company',
          align: 'center'
        },
        {
          title: '问题油卡号',
          key: 'card_num_all',
          align: 'center'
        },
        {
          title: '开卡日期',
          key: 'card_time',
          align: 'center',
          width: 150
        },
        {
          title: '卡片状态',
          key: 'card_type',
          align: 'center',
          width: 150
        },
        {
          title: '交易记录',
          key: 'transaction_time',
          align: 'center',
          width: 150
        },
        {
          title: '首次使用日期',
          key: 'min_time',
          align: 'center',
          width: 150
        },
        {
          title: '休眠时长',
          key: 'end_time',
          align: 'center',
          width: 150
        }
        // {
        //   title: '操作',
        //   slot: 'action',
        //   width: 150,
        //   align: 'center'
        // }
        // {
        //   title: '交易时间',
        //   key: 'f'
        // }
      ],
      data6: []
    }
  },
  methods: {
    async init () {
      // console.log('没传', data)
      let xiumian = {
        end_time: this.formItem.end_time
        // end_time: '30'
      }
      getSpvOilcompaniesList(xiumian).then(ret => {
        this.data6 = ret.data.data.results
        this.total = ret.data.data.totalRecord
      })
    },
    search () {
      const data = {
        company: this.formItem.company,
        end_time: this.formItem.end_time
      }
      getSpvOilcompaniesList(data).then(ret => {
        this.data6 = ret.data.data.results
        this.total = ret.data.data.totalRecord
      })
      console.log('没传', data)
    },
    pageAction (current) {
      getSpvOilcompaniesList({ pageNo: current,
        company: this.formItem.company,
        end_time: this.formItem.end_time }).then(ret => {
        this.data6 = ret.data.data.results
      })
    },
    see () {
      this.$router.push({
        name: 'longXm'
      })
    },
    exportData () {
      this.$router.push({
        name: 'xmk'
      })
    }
  },

  watch: {

  },

  mounted () {
    this.init()
  }
}

</script>

<style scoped>

</style>
